package com.itheima.myscoket.Demo5;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class Demo2 {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(10000);
        Socket accept = ss.accept();
        InputStream is = accept.getInputStream();
        int len;
        while((len = is.read())!=-1){
            System.out.print ((char) len);
        }


        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(accept.getOutputStream()));
        bw.write("你是谁");
        bw.newLine();
        bw.flush();
        bw.close();
        is.close();
        ss.close();

    }
}
